﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace yinyue
{
    class Like
    {
        private static Like like=null;
        private List<Songlist> list = new List<Songlist>();
        private Like() { }
        public static Like getLike()
        {
            if (like == null)
            {
                like = new Like();
            }
            return like;
        }
        public bool addSong(Songlist song) 
        {
            try 
	        {
                list.Add(song);
                return true;
	         }
	        catch (Exception)
	        {
                return false;
	        }
        }
        public List<Songlist> getSongList() 
        {
            return list;
        }
        public List<Songlist> deleteList(int id) 
        {
            List<Songlist> song = new List<Songlist>();
            foreach (var item in list)
            {
                if (id==item.songid)
                {
                    list.Remove(item);
                    song = list;
                    break;
                }
            }
            return song;
        }

    }
}
